import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import index from '../views/index.vue'
import login from '../views/login.vue'
import financialReport from '../views/financialReport.vue'
import financialComplaint from '../views/financialComplaint.vue'
import financialCollection from '../views/financialCollection.vue'
import orderDetail from '../views/orderDetail.vue'
import orderDetails from '../views/orderDetails.vue'
import seeMerchant from '../views/seeMerchant.vue'
import merchantManagement from '../views/merchantManagement.vue'
import editMerchant from '../views/editMerchant.vue'
import addMerchant from '../views/addMerchant.vue'
import embodimentApplication from '../views/embodimentApplication.vue'
import embodimentDetail from '../views/embodimentDetail.vue'
import operationLog from '../views/operationLog.vue'
import occupancyApplication from '../views/occupancyApplication.vue'
import occupancyApplicationcl from '../views/occupancyApplicationcl.vue'
import headList from '../views/headList.vue'
import headListadd from '../views/headListadd.vue'
import headListedit from '../views/headListedit.vue'
import headListevaluate from '../views/headListevaluate.vue'
import Afresidence from '../views/afresidence.vue'
import Afresidencexiangq from '../views/afresidencexiangq.vue'
import coupon from '../views/coupon.vue'
import systemrole from '../views/systemRole.vue'
import systememployees from '../views/systemEmployees.vue'
import systemmenu from '../views/systemMenu.vue'
import secondsTime from '../views/secondsTime.vue'
import serviceIndex from '../views/serviceIndex.vue'
import notice from '../views/notice.vue'

// 修改页面路由重复点击报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component:login
  },
  {
    path: '/index',
    name: 'index',
    component:index,
    children:[
      {
        path: '/',
        name: 'Home',
        component:Home,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //商家管理
      {
        path: 'merchantManagement',
        name: 'merchantManagement',
        component:merchantManagement,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //入驻申请
      {
        path: 'occupancyApplication',
        name: 'occupancyApplication',
        component:occupancyApplication,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //入驻申请处理
      {
        path: 'occupancyApplicationcl',
        name: 'occupancyApplicationcl,',
        component:occupancyApplicationcl,
        // meta:{
        //     requireAuth:true
        //  }
      },
        // 团长列表
        {
          path: 'headList',
          name: 'headList',
          component:headList,
          // meta:{
          //     requireAuth:true
          //  }
        },
          // 团长列表新增商家
          {
            path: 'headListadd',
            name: 'headListadd',
            component:headListadd,
            // meta:{
            //     requireAuth:true
            //  }
          },
         // 团长评价
         {
          path: 'headListevaluate',
          name: 'headListevaluate',
          component:headListevaluate,
          // meta:{
          //     requireAuth:true
          //  }
        },
        //团长详情
        {
          path: 'headListedit',
          name: 'headListedit',
          component:headListedit,
          // meta:{
          //     requireAuth:true
          //  }
        },
      // 查看商家
      {
        path: 'seeMerchant',
        name: 'seeMerchant',
        component:seeMerchant,
        // meta:{
        //     requireAuth:true
        //  }
      },
       // 编辑商家
       {
        path: 'editMerchant',
        name: 'editMerchant',
        component:editMerchant,
        // meta:{
        //     requireAuth:true
        //  }
      },
        // 入驻申请
        {
          path: 'afresidence',
          name: 'afresidence',
          component:Afresidence,
          // meta:{
          //     requireAuth:true
          //  }
        },
          // 团长入驻申请详情
          {
            path: 'afresidencexiangq',
            name: 'afresidencexiangq',
            component:Afresidencexiangq,
            // meta:{
            //     requireAuth:true
            //  }
          },
       // 添加商家
       {
        path: 'addMerchant',
        name: 'addMerchant',
        component:addMerchant,
        // meta:{
        //     requireAuth:true
        //  }
      },
       //财务报表
       {
        path: 'financialReport',
        name: 'financialReport',
        component:financialReport,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //申诉订单
      {
        path: 'financialComplaint',
        name: 'financialComplaint',
        component:financialComplaint,
        // meta:{
        //     requireAuth:true
        //  }
      },
       //优惠券
       {
        path: 'coupon',
        name: 'coupon',
        component:coupon
      },
      //提现申请记录
      {
        path: 'embodimentDetail',
        name: 'embodimentDetail',
        component:embodimentDetail,
        // meta:{
        //     requireAuth:true
        //  }
      },
        //提现详情
        {
          path: 'embodimentApplication',
          name: 'embodimentApplication',
          component:embodimentApplication,
          // meta:{
          //     requireAuth:true
          //  }
        },
      //收款账户
      {
        path: 'financialCollection',
        name: 'financialCollection',
        component:financialCollection,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //订单明细
      {
        path: 'orderDetail',
        name: 'orderDetail',
        component:orderDetail,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //订单详情
      {
        path: 'orderDetails/:id',
        name: 'orderDetails',
        component:orderDetails,
        // meta:{
        //     requireAuth:true
        //  }
      },
       //操作日志
       {
        path: 'operationLog',
        name: 'operationLog',
        component:operationLog,
        // meta:{
        //     requireAuth:true
        //  }
      },
      //系统管理-角色管理
      {
        path: 'systemrole',
        name: 'systemrole',
        component:systemrole,
      },
      //系统管理-角色管理
      {
        path: 'systememployees',
        name: 'systememployees',
        component:systememployees,
      },
      //系统管理-菜单管理
      {
        path: 'systemmenu',
        name: 'systemmenu',
        component:systemmenu,
      },
      //秒杀管理-秒杀时间
      {
        path: 'secondsTime',
        name: 'secondsTime',
        component:secondsTime,
      },
      //通知公告-消息
      {
        path: 'notice',
        name: 'notice',
        component:notice,
      },
      //在线客服
      {
        path: 'serviceIndex',
        name: 'serviceIndex',
        component:serviceIndex,
      },
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes,
  //刷新页面回到顶部
  // scrollBehavior (to, from, savedPosition) {
  //   return { x: 0, y: 0 }
  // },
})

export default router
